Skip to main content

SI Units

Conversions between SI quantities (speed, opening) and the command/status blocks' 0..255 register values, scaled by a DeviceProfile.

Every mapping here is linear and the gripper is not: the manual gives the 2F speed scale as approximate, and a register value is a setpoint, not a measurement.

Speed maps [minSpeed, maxSpeed] onto register values 0..255, because value 0 is the gripper's minimum, not zero. A value below minSpeed floors at register 0 and a value above maxSpeed saturates at 255. NaN, infinity and a negative value yield nothing: no benign caller produces them.

Opening maps [minOpening, maxOpening] onto the profile's register band and clamps to those ends rather than rejecting, because position setpoints from interpolating controllers overshoot the ends by a hair and holding the previous command there would be the wrong outcome. Values round to nearest, so inside the band a position read back commands the same value. A closed gripper settles a few steps either side of closedPosition, so a reading there converts to an opening a touch off minOpening; values past the band read as the nearest end.

A profile the arithmetic cannot use (a non-positive position span or register band, or maxSpeed at or below minSpeed) yields nothing.

warning

The opening conversions (openingToRegister, openingFromRegister) are only valid while the gripper stays in parallel-finger mode. In encompassing mode gPO can exceed closedPosition; openingFromRegister has no way to detect that and clamps the reading to the nearest end instead, which does not reflect the real opening.

Example
  namespace units = Robotiq::units;
 
  constexpr double kSpeed = 0.150; // m/s
  constexpr double kOpening = 0.040; // m
  constexpr double kEffort = 0.5; // fraction of maximum force
 
  command.speed = units::speedToRegister(kSpeed, k2F85).value();
  command.force = units::effortToRegister(kEffort).value();
  command.positionRequest = units::openingToRegister(kOpening, k2F85).value();
 
  double openingMetres = units::openingFromRegister(gripper.getStatus().position, k2F85).value();

Members

Classes
structDeviceProfile

Gripper model specific profile gathering specifications such as opening range and speed. More...

Functions
std::optional< uint8_t >registerFromSpan (double value, double minimum, double maximum)
std::optional< uint8_t >speedToRegister (double speed, const DeviceProfile &profile)
std::optional< uint8_t >openingToRegister (double opening, const DeviceProfile &profile)
std::optional< double >openingFromRegister (uint8_t value, const DeviceProfile &profile)
std::optional< uint8_t >effortToRegister (double effort)
constexpr doublemotorCurrentFromRegister (uint8_t value)
Variables
constexpr DeviceProfilek2F85 {0.020, 0.150, 0.0, 0.085, 3, 230}

The measured profile for the 2F-85. More...

Functions

effortToRegister()

std::optional< uint8_t > Robotiq::units::effortToRegister(doubleeffort
)

Effort in [0, 1] -> rFR. 0 is the gripper's minimum force, 1 its maximum; a value above 1 saturates at register 255.

Parameters
effort

Requested gripping effort, as a fraction of the gripper's force range.

Returns

rFR, or std::nullopt if effort is non-finite or negative.

motorCurrentFromRegister()

constexpr double Robotiq::units::motorCurrentFromRegister(uint8_tvalue
)
inline constexpr

gCU -> motor current in A.

Parameters
value

The raw register value (gCU).

Returns

The motor current in amperes.

openingFromRegister()

std::optional< double > Robotiq::units::openingFromRegister(uint8_tvalue,
const DeviceProfile &profile
)

gPO -> opening in m.

warning

Valid only while the gripper stays in parallel-finger mode. A gPO reading taken in encompassing mode can exceed profile.closedPosition and is clamped to the nearest end below instead of reflecting the real opening.

Parameters
value

The raw register value (gPO). A value outside the profile's register band reads as the nearest end.

profile

The device profile to scale against.

Returns

The opening in metres, or std::nullopt if profile is one the arithmetic can't use (non-positive position span or register band).

openingToRegister()

std::optional< uint8_t > Robotiq::units::openingToRegister(doubleopening,
const DeviceProfile &profile
)

Opening in m -> rPR.

warning

Valid only while the gripper stays in parallel-finger mode: profile.minOpening/maxOpening and the register endpoints are measured in that mode, so a register computed here does not correspond to a real opening once the gripper switches to encompassing mode.

Parameters
opening

Target opening, in metres. Clamped to [profile.minOpening, profile.maxOpening] rather than rejected — a value outside that range reads as the nearest end. Values round to the nearest register.

profile

The device profile to scale against.

Returns

rPR, or std::nullopt if opening is non-finite, or profile is one the arithmetic can't use (non-positive position span or register band).

registerFromSpan()

std::optional< uint8_t > Robotiq::units::registerFromSpan(doublevalue,
doubleminimum,
doublemaximum
)

Linear map of [minimum, maximum] onto register values 0..255, the rule speedToRegister applies. Public for callers that carry their own scales instead of a DeviceProfile.

Parameters
value

The quantity to convert. A value below minimum floors at register 0; a value above maximum saturates at 255.

minimum

The value that maps to register 0.

maximum

The value that maps to register 255.

Returns

The mapped register, or std::nullopt if value is non-finite or negative, minimum or maximum is non-finite, or maximum is at or below minimum.

speedToRegister()

std::optional< uint8_t > Robotiq::units::speedToRegister(doublespeed,
const DeviceProfile &profile
)

Speed in m/s -> rSP.

Parameters
speed

Requested speed, in m/s. A value below profile.minSpeed floors at register 0; a value above profile.maxSpeed saturates at 255.

profile

The device profile to scale against.

Returns

rSP, or std::nullopt if speed is non-finite or negative, or profile is one the arithmetic can't use (maxSpeed at or below minSpeed).

Variables

k2F85

constexpr DeviceProfile Robotiq::profiles::k2F85 {0.020, 0.150, 0.0, 0.085, 3, 230}
constexpr

The measured profile for the 2F-85.

warning

Assumes that the gripper is in parallel-finger mode.


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.